package com.minhang.utils.result;

/**
 * 响应码枚举，参考HTTP状态码的语义
 * @author dkj
 */
public enum ResultCode {
    /**
     *  //成功
     */
    SUCCESS(200,"ok"),
    /**
     * //失败
     */
    FAIL(400,"失败"),

    /**
     * 权限不足
     */
    AUTHORITY(403,"权限不足"),

    /**
     * 登录失败
     */
    FAILURE(401,"登录失败"),

    /**
     * //未认证（签名错误）
     */
    UNAUTHORIZED(1001,"未通过认证"),


    /**
     * 空指针
     */
    NullPOINTER(1415,"空指针"),

    /**
     * 参数异常
     */
    NUM_BER_FORMAT(1416,"参数异常"),

    /**
     * 类型不存在
     */
    TypeNotPresent(1417,"类型不存在"),


    /**
     * 索引越界
     */
    IndexOutOfBounds(1418,"索引越界"),

    /**
     * 数组索引越界
     */
    ArrayIndexOutOfBounds(1419,"数组索引越界"),
    /**
     * 数组存储异常
     */
    ArrayStore(1419,"数组存储异常"),


    /**
     * 虚拟机错误
     */
    VirtualMachineError(1420,"虚拟机错误"),

    /**
     * 堆栈溢出
     */
    StackOverflowError(1421,"堆栈溢出"),


    /**
     * 内存不足
     */
    OutOfMemoryError(1422,"内存不足"),

    /**
     * sql异常
     */
    SqlSessionException(1423,"sql异常"),


    /**
     * //接口不存在
     */
    NOT_FOUND(404,"接口不存在"),
    /**
     * //服务器内部错误
     */
    INTERNAL_SERVER_ERROR(500,"内部服务器错误");


    private final int code;
    private final String message;

    ResultCode(int code,String message) {
        this.code = code;
        this.message = message;
    }

    public int code() {
        return code;
    }

    public String message(){return message;}
}
